<template>
	<view class="content" :style="'background:'+publicTextColor.app_bg_color+';'">
		<view class="topTitle" :style="'top:'+zhuangtai+'px'">
			<image class="back" @click="backClick" :src="publicimg.btn_back" mode=""></image>
			<view class="" style="font-size: 32rpx;">
				常见问题
			</view>
		</view>
		<view class="listindex" :style="'margin-top:'+(zhuangtai+52)+'px;'"></view>
		<view class="problemlist" @click="openproblem(item)" v-for="(item, index) in problemlist" :key="index" :style="'background:'+publicTextColor.app_theme_color+';'">
			<view class="itemindex">
				<view class="font34" :style="'color:'+publicTextColor.font_1st_color+';'">{{item.name}}</view>
				<image class="morebottom" :class="item.state?'trao':'trac'" :src="publicimg.btn_spread" mode=""></image>
			</view>
			<rich-text v-if="item.state":nodes="item.content" class="text1 font28" :style="'color:'+publicTextColor.font_3rd_color+';'"></rich-text>
		</view>
	</view>
</template>

<script>
	var util = require('@/js/util.js')
	export default {
		data() {
			return {
				publicTextColor:'',
				publicimg:'',
				zhuangtai:0,
				probolemId:0,
				problemlist:[]
			};
		},
		onShow() {
			this.getProblemData()
			let that = this
			let aniosgaodu = 0
			uni.getSystemInfo({
				success: function(res) {
					console.log(res);
					that.zhuangtai = res.statusBarHeight;
					var a = res.model.split(' ');
					if (a[0] == 'iPhone') {
						aniosgaodu = 44;
					} else {
						aniosgaodu = 48;
					}
					that.zhuangtai = parseInt(that.zhuangtai)+4
					console.log(that.zhuangtai)
				}
			});
		},
		onLoad() {
			this.setcolorConfig()
		},
		methods:{
			getProblemData(){
				let _self = this
				uni.request({
					url: util.getUrl("member/qa"),
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation':uni.getStorageSync("token")
					},
					data:{
					},
					method: 'POST',
					success: res => {
						if(res.data.code == 1){
							_self.problemlist = res.data.data.list
						}
					},
				});
			},
			openproblem(item){
				item.state = !item.state
			},
			setcolorConfig(){
				this.publicTextColor = uni.getStorageSync("diyColor")
				this.publicimg = uni.getStorageSync("diyImg")
			},
			backClick(){
				uni.navigateBack({
					
				})
			}
		}
	}
</script>

<style lang="scss">
	.problemlist{
		width: 690rpx;
		display: flex;
		flex-direction: column;
		border-radius: 20rpx;
		box-sizing:  border-box;
		padding: 31rpx 30rpx 38rpx 30rpx;
		margin-bottom: 30rpx;
		.itemindex{
			display: flex;
			align-items: center;
			justify-content: space-between;
			.morebottom{
				width: 31rpx;
				height: 20rpx;
			}
			.trao{
				transform: rotate(180deg);
			}
			.trac{
				transform: rotate(0deg);
			}
		}
		.text1{
			margin-top: 50rpx;
			line-height: 40rpx;
		}
	}
	.listindex{
		width: 690rpx;
	}
	.content{
		min-height: 100vh;
		width: 750rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
	}
	.topTitle{
		color: #FFFFFF;
		display: flex;
		align-items: center;
		height: 67rpx;
		justify-content: center;
		position: absolute;
		z-index: 10;
		width: 100%;
		.back{
			width: 20rpx;
			height: 31rpx;
			position: absolute;
			left: 31rpx;
		}
	}
</style>
